import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import router from "./router/index.js"; //引入路由
import "normalize.css"; //引入normalize.css重置样式表
import store from "./store/index.js"; //引入store状态机对象
import "./utils/leancloud-init"; //leancloud的初始化

//让本地存储和状态机关联起来，不会每次刷新页面都丢失数据导致重新登录
let uinfo = localStorage.getItem('userInfo')
if (uinfo) {
  store.commit('user/initInfoMut', JSON.parse(uinfo))
}

import * as ElementPlusIconsVue from "@element-plus/icons-vue";

const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  //批量挂载图标组件
  app.component(key, component);
}

app.use(router); //注册路由
app.use(store); //注册store状态机对象
app.mount("#app");
